﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;

namespace MengCC.Common.Serialize
{
    public class BinaryConvert
    {
        public static void SerializeObject(Stream stream,object value)
        {
            var formater = new BinaryFormatter();
            formater.Serialize(stream, value);
        }

        public static T DeserializeObject<T>(Stream stream)
        {
            var formater = new BinaryFormatter();
            return (T)formater.Deserialize(stream);
        }
    }
}
